package com.sky.mapper;

import com.sky.entity.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper   //口味接口
public interface DishFlavorMapper {
    //向口味表批量加入
    void insertBatch(List<DishFlavor> flavors);  //Mapper接口方法接受的形参名称要和xml或者sql注释上的名称一致

    //根据菜品id删除口味
    @Delete("delete from sky_take_out.dish_flavor where dish_id=#{dishId}")
    void deleteByDishId(Long dishId);
    //根据菜品id批量删除口味
    void deleteByDishIds(List<Long> dishIds);

    //根据菜品id查询口味
    @Select("select * from sky_take_out.dish_flavor where  dish_id=#{dishId}")
    List<DishFlavor> getByDishId(Long dishId);
}
